<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<header id="header" class="container">
    <div class="row">
        <div class="col-xs-8 col-md-4"><img src="/img/logo.jpg"></div>
        <div class="hidden-xs hidden-sm col-md-4"><h1 class="text-center">考试信息管理系统</h1></div>
        <div class="col-xs-4 col-md-4 text-right" th:if="${#httpServletRequest.requestURI == '/'}">
            <shiro:notAuthenticated>
                <a th:href="@{/login}">登录</a>
                <a th:href="@{/register}">注册</a>
            </shiro:notAuthenticated>
            <shiro:authenticated>
                欢迎 <strong shiro:principal property="usrName"></strong>
                <span shiro:hasRole="USER">学生</span>
                <span shiro:hasRole="ADMIN">老师</span>
                <span shiro:hasRole="SYSTEM">主任</span>
                访问<br>
                <a th:href="@{/logout}"> 退出</a>
            </shiro:authenticated>
        </div>
    </div>
</header>
<nav id="nav" class="navbar navbar-inverse">
    <div class="container">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" th:href="@{/}">首页</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav" shiro:hasRole="USER">
                <li th:class="${#httpServletRequest.requestURI.endsWith('/test')} ? active">
                    <a href="/test">在线考场 <span class="sr-only">(test)</span></a>
                </li>
                <li th:class="${#httpServletRequest.requestURI.endsWith('/score')} ? active">
                    <a href="/score">我的成绩 <span class="sr-only">(score)</span></a>
                </li>
            </ul>
            <ul class="nav navbar-nav" shiro:hasRole="ADMIN">
                <li th:class="${#httpServletRequest.requestURI.endsWith('/addPaper')} ? active">
                    <a href="/addPaper">添加试卷 <span class="sr-only">(add paper)</span></a>
                </li>
                <li th:class="${#httpServletRequest.requestURI.endsWith('/managePaper')} ? active">
                    <a href="/managePaper">管理试卷 <span class="sr-only">(manage paper)</span></a>
                </li>
            </ul>
            <ul class="nav navbar-nav" shiro:hasRole="SYSTEM">
                <li th:class="${#httpServletRequest.requestURI.endsWith('/manageAccount')} ? active">
                    <a href="/manageAccount">管理账户 <span class="sr-only">(manage account)</span></a>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<footer id="footer" class="container-fluid">
    <p class="text-center">
        Copyright: &copy;2001-2023 版权所有
    </p>
</footer>
</html>